<?php
declare(strict_types=1);

use Phinx\Migration\AbstractMigration;

final class AddIndexUserIdIndexInTaskWorkOrderUserTable extends AbstractMigration
{
    public function up()
    {
        $this->table('task_work_order_user')->addIndex(['user_id', 'work_order_id'], ['name' => 'idx_user_id', 'type' => 'unique'])->save();
        $this->table('task_work_order')->addIndex(['deadline_time', 'status', 'project_id'], ['name' => 'idx_deadline_time_status_project', 'type' => 'normal'])->save();
    }

    public function down()
    {
        $this->table('task_work_order_user')->removeIndexByName('idx_user_id')->save();
        $this->table('task_work_order')->removeIndexByName('idx_deadline_time_status_project')->save();
    }
}
